package model

import (
	"gorm.io/gorm"
	"time"
)

// 用户表
type User struct {
	gorm.Model
	Mobile   int    `json:"mobile" form:"mobile" url:"mobile" binding:"required"`
	HeadImg  string `json:"head_img" form:"head_img" url:"head_img" binding:"required"`
	NickName string `json:"nick_name" form:"nick_name" url:"nick_name" binding:"required"`
	//话题
	Topic string `json:"topic" form:"topic" url:"topic" binding:"required"`
	//关注
	Reals int `json:"reals" form:"reals" url:"reals" binding:"required"`
	//粉丝
	Fs        int       `json:"fs" form:"fs" url:"fs" binding:"required"`
	LoginTime time.Time `json:"login_time" form:"login_time" url:"login_time" binding:"required"`
}

// 帖子表
type Pot struct {
	gorm.Model
	UserId  int    `json:"user_id" form:"user_id" url:"user_id" binding:"required"`
	Title   string `json:"title" form:"title" url:"title" binding:"required"`
	Content string `json:"content" form:"content" url:"content" binding:"required"`
	Image   string `gorm:"type:varchar(500)" json:"image" form:"image" url:"image" binding:"required"`
	//权限
	Permission string `json:"permission" form:"permission" url:"permission" binding:"required"`
	//关注关系
	Follow  string `json:"follow" form:"follow" url:"follow" binding:"required"`
	HotNum  int    `json:"hot_num" form:"hot_num" url:"hot_num" binding:"required"`
	LikeNum int    `json:"like_num" form:"like_num" url:"like_num" binding:"required"`
	Review  string `json:"review" form:"review" url:"review" binding:"required"`
	Type    string `json:"type" form:"type" url:"type" binding:"required"`
}

// 评论表
type Comment struct {
	gorm.Model
	UserId  int    `json:"user_id" form:"user_id" url:"user_id" binding:"required"`
	DistId  int    `json:"dist_id" form:"dist_id" url:"dist_id" binding:"required"`
	Content string `json:"content" form:"content" url:"content" binding:"required"`
}

// 喜欢表
type Like struct {
	gorm.Model
	UserId int    `json:"user_id" form:"user_id" url:"user_id" binding:"required"`
	DistId int    `json:"dist_id" form:"dist_id" url:"dist_id" binding:"required"`
	Status string `json:"status" form:"status" url:"status" binding:"required"`
}

// 帖子详情表
type PotData struct {
	gorm.Model
	UserId  int    `json:"user_id" form:"user_id" url:"user_id" binding:"required"`
	Title   string `json:"title" form:"title" url:"title" binding:"required"`
	Content string `json:"content" form:"content" url:"content" binding:"required"`
	Image   string `gorm:"type:varchar(500)" json:"image" form:"image" url:"image" binding:"required"`
	//关注关系
	Follow   string `json:"follow" form:"follow" url:"follow" binding:"required"`
	HotNum   int    `json:"hot_num" form:"hot_num" url:"hot_num" binding:"required"`
	LikeNum  int    `json:"like_num" form:"like_num" url:"like_num" binding:"required"`
	Comments string `json:"comments" form:"comments" url:"comments" binding:"required"`
}
